﻿using System;
using System.Text;
using ZHDJ.Core.Util;

namespace ZHDJ.Web.PortalParts
{
    public partial class ImageAuto : System.Web.UI.UserControl
    {
        #region 属性
        public string ImgUrl
        {
            get
            {
                var s = (string)ViewState["ImgUrl"];
                return s ?? string.Empty;
            }
            set
            {
                ViewState["ImgUrl"] = value;
            }
        }

        public string ImgTitle
        {
            get
            {
                var s = (string)ViewState["ImgTitle"];
                return s ?? string.Empty;
            }
            set
            {
                ViewState["ImgTitle"] = value;
            }
        }
        /// <summary>
        /// json数据
        /// </summary>
        public string Para
        {
            get
            {
                var s = (string)ViewState["Para"];
                return s ?? string.Empty;
            }
            set
            {
                ViewState["Para"] = value;
            }
        }
        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            PageUtility.RegisterResource(this.Page, "/Resource/js/Nailthumb/jquery.nailthumb.1.1.min.js", "imageautoJs", PageUtility.ResType.Js);
            PageUtility.RegisterResource(this.Page, "/Resource/js/Nailthumb/jquery.nailthumb.1.1.min.css", "imageautoCss", PageUtility.ResType.Css);
            var script = new StringBuilder();
            script.Append("<script type=\"text/javascript\">");
            script.Append(" $(function () {");
            script.Append("  $('#" + ClientID + "').nailthumb(" + Para + ");");
            script.Append(" });");
            script.Append("</script>");
            PageUtility.RegisterScript(this.Page, script.ToString(), "imageautoReadey" + ID);
        }
    }
}